import request from '@/utils/request'
import qs from 'qs'

export function login (username, password) {
  const data = {
    username: username,
    password: password
  }

  return request({
    url: '/admin/login',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: qs.stringify(data)
  })
}

export function logout () {
  return request({
    url: '/admin/logout',
    method: 'get'
  })
}

export function getUserInfo (token) {
  return request({
    url: '/admin/info',
    method: 'get'
  })
}
